package house

import "github.com/name5566/leaf/log"

func HouseList(userId string) (map[string]interface{}, error) {
	var ret = make(map[string]interface{}, 0)
	logic := NewHouseLogic()
	info, err := logic.houseInfo(userId)
	if err != nil {
		return nil, err
	}
	ret["house_list"] = info
	return ret, nil
}
func UnLockHouse(userId string, houseId int32) (map[string]interface{}, error) {
	var ret = make(map[string]interface{}, 0)
	logic := NewHouseLogic()
	info, err := logic.unLockHouse(userId, houseId)
	if err != nil {
		return nil, err
	}
	ret["house_list"] = info
	return ret, nil
}
func UnlockFurniture(userId string, houseId, furnitureId int32) (map[string]interface{}, error) {
	var ret = make(map[string]interface{}, 0)
	logic := NewHouseLogic()
	info, err := logic.unlockFurniture(userId, houseId, furnitureId)
	if err != nil {
		return nil, err
	}
	ret["house_list"] = info
	return ret, nil
}
func AddFurniture(userId string, houseId, furnitureId int32) (map[string]interface{}, error) {
	var ret = make(map[string]interface{}, 0)
	logic := NewHouseLogic()
	info, err := logic.addFurniture(userId, houseId, furnitureId)
	if err != nil {
		return nil, err
	}
	ret["house_list"] = info
	return ret, nil
}
func NewUserHouse(userId string, houseId int32) (map[string]interface{}, error) {
	var ret = make(map[string]interface{}, 0)
	logic := NewHouseLogic()
	info, err := logic.initHouse(userId, houseId)
	if err != nil {
		log.Error("创建房屋失败")
		return nil, err
	}
	ret["house_list"] = info
	return ret, nil
}
